Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#5626] feat (gvfs-fuse): Set up a submodule project for the Gvfs-fuse #5627

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

diqiu50
Copy link
Contributor

@diqiu50 diqiu50 commented Nov 20, 2024

What changes were proposed in this pull request?

Set up a submodule project for the Gvfs-fuse, layout the rust module environment for gvfs-fuse

Why are the changes needed?

Fix: #5626

Does this PR introduce any user-facing change?

No

How was this patch tested?

No

settings.gradle.kts Outdated Show resolved Hide resolved
Copy link
Member

@xunliu xunliu Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need use a Gradle for Rust plugin to compile this module, just like client-python.
maybe we can use the Gradle Rust plugin to install Rust compile tools in the temp dir.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried some rust plugins. I can't found a good one

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 20, 2024

suggest to do some auto check like cargo-machete cargo-sort cargo clippy cargo fmt, you could refer https://github.com/apache/iceberg-rust/blob/main/.github/workflows/ci.yml#L55-L68

exit 1
fi

export PATH="$HOME/.cargo/bin:$PATH"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if I run this script several times?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If successful, the install branch can be skipped

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we don't do this in the script.
Most of the software installer scripts avoid doing this.
It may and may not be desirable for the user.

clients/gvfs-fuse/check_rust_env.sh Outdated Show resolved Hide resolved
clients/gvfs-fuse/build.gradle.kts Outdated Show resolved Hide resolved
Comment on lines +24 to +45
if ! command -v cargo &> /dev/null; then
echo "Rust is not installed. Installing Rust..."

if command -v curl &> /dev/null; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
elif command -v wget &> /dev/null; then
wget -qO- https://sh.rustup.rs | sh -s -- -y
else
echo "Error: Neither curl nor wget is available. Please install one of them to proceed."
exit 1
fi

export PATH="$HOME/.cargo/bin:$PATH"
if command -v cargo &> /dev/null; then
echo "Rust has been installed successfully."
else
echo "Error: Rust installation failed. Please check your setup."
exit 1
fi
else
echo "Rust is already installed: $(cargo --version)"
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd do this to 1) return early if possible 2) save some of the nested if- tests.

if command -v cargo &> /dev/null; then
    echo "Rust is already installed: $(cargo --version)"
    exit 0
fi

echo "Rust is not installed. Installing Rust..."
# the rest of the install and check
# ...
if ! command -v cargo &> /dev/null; then
    echo "Error: Rust installation failed. Please check your setup."
    exit 1
fi

echo "Rust has been installed successfully."
exit 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cargo command does not run after running the rust installation command. Unless you set the PATH environment variable or restart the bash session.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well ... we are assuming that cargo is installed in a specific directory, i.e. $HOME/.cargo/bin, any way...
The only difference is that we manually invoke the binary (with full path) or let the "polluted" shell to find it. Right?

Copy link
Contributor Author

@diqiu50 diqiu50 Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the cargo install script will add logic to modify the PATH inn the .profile. If we restart the shell session, it will automatically add this environment variable.
Is modifying the PATH not allowed?

@jerryshao
Copy link
Contributor

@FANNG1 can you please help to review?

[package]
name = "filesystem-fuse"
version = "0.8.0-incubating-SNAPSHOT"
edition = "2021"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the usage of this "edition", shall we remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version specify the minimum Rust compiler version required for this project.

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 21, 2024

suggest adding basic check for code style and common errors in ci

        cargo  fmt --all -- --check
        cargo  clippy --all-targets --all-features --workspace -- -D warnings

name = "filesystem-fuse"
version = "0.8.0-incubating-SNAPSHOT"
edition = "2021"
rust-version = "1.75"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also add homepage, repository, license ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diqiu50 do you plan to add these things?

path = "src/main.rs"

[dependencies]
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many fuse implement in RUST, why you choose fuse3?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fuser is more popular

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fuser is more popular, but FUSE3 is used by OpenDAL. We need to decide which one to use soon

@jerryshao
Copy link
Contributor

@FANNG1 can you please help to review again? If there's no blocking issue, I think we can improve the building command in the following PRs, what do you think?

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 23, 2024

@FANNG1 can you please help to review again? If there's no blocking issue, I think we can improve the building command in the following PRs, what do you think?

Seems there're some basic issues to be addressed,

  1. Whether to build fuse-rust by default, I prefer not, because it's difficult for most persons.
  2. To enable code style and clippy check, I'm ok to add the check in this or next PR.
  3. Which rust fuse lib should we choose, if we doesn't have an answer for now, I prefer to remove the current fuse depedences.

@diqiu50 diqiu50 requested a review from FANNG1 November 25, 2024 03:55
@diqiu50
Copy link
Contributor Author

diqiu50 commented Nov 25, 2024

@FANNG1
I have made modifications. The -Penable_gvfs_fuse parameter needs to be added to build gvfs_fuse, and it will not automatically install Rust."

name = "filesystem-fuse"
version = "0.8.0-incubating-SNAPSHOT"
edition = "2021"
rust-version = "1.75"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diqiu50 do you plan to add these things?


set -e

if ! command -v cargo &> /dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the file to install_rust_env.sh, and place it in dev directory?

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 25, 2024

LGTM, except minor comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Subtask] [gvfs-fuse] Set up a submodule project for the Gvfs-fuse.
6 participants